/* Copyright © 2007 sample Computer Corporation Limited
 * All rights reserved.
 * 
 * Date: 2007-6-15
 * author: fungus  (fungus@gmail.com)
 *
 */
package com.glodon.ggzy.core.model;

/**
 * 
 * 
 * 实体基类
 * @author zhangxj
 * @since jdk1.6
 * @date 2013-6-17
 *
 */
public abstract class BaseModel {

	protected boolean equals(String child, String other) {
		return objEquals(child, other);
	}

	protected int hashCode(String id) {
		return objHashCode(id);
	}

	protected boolean equals(Long child, Long other) {
		return objEquals(child, other);
	}

	protected int hashCode(Long id) {
		return objHashCode(id);
	}

	protected boolean equals(Integer child, Integer other) {
		return objEquals(child, other);
	}

	protected int hashCode(Integer id) {
		return objHashCode(id);
	}

	protected boolean objEquals(Object child, Object other) {
		if (child == other)
			return true;
		if (child == null || other == null)
			return false;
		return child.equals(other);
	}

	protected int objHashCode(Object id) {
		if (id == null)
			return super.hashCode();
		return id.hashCode();
	}
}
